home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / exec / scheduler.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-29  |  23KB  |  775 lines

  1. /* ***********************************************************************
  2.  
  3.    SCHEDULER PROGRAM FOR FOOTBALL REXX SUITE
  4.   -------------------------------------------
  5.                    Copyright  Mark Naughton 1996
  6.  
  7.  
  8. Version    Date     History
  9. --------------------------------------------------------------------------
  10.  1.0       090996   First release.
  11.            180996   Changed record-count so that it is stored in element
  12.                     zero of each array. Deleted some variable assigns
  13.                     that weren't needed. Amended reading into arrays so
  14.                     that the count is set correctly for one element.
  15.                     Removed all "call "references before library routines.
  16.            270996   Added code to sort 'Teams.df' and to recreate it.
  17.                     Changed a few messages and tidied up.
  18.            ******   Decided not to store goalscorers. Was not viable as
  19.                     too much data would have to be collected.
  20.            270996   Added code for points_per_draw and points_per_loss.
  21.                     Now uses DOS Delete command, not the support function.
  22.                     Amended reading in of teams - quicker, tidier. Added
  23.                     code to display a report on the league. Updated to
  24.                     use new filenames. Improved error messages. Added
  25.                     error check for more than 1000 matches.
  26.  1.1       131196   Added argument so it can become a component of
  27.                     FOOTBALL. Removed all messages. Added checks for
  28.                     files - if not found, exits without a message.
  29.                     Rewrote report.
  30.            201196   Added code to store relegation. All this will do is
  31.                     display a line across the league table. Amended msg
  32.                     for play_each_other. Added code to allow teams to
  33.                     play each other more than twice.
  34.            201196   Decided not to implement PreviousPosition as it would
  35.                     require file changes and a reformat of the league
  36.                     table. It may be implemented soon though.
  37.            211196   Updated and tidied the display.
  38.            201296   Fixed bug where if the number of times that each team
  39.                     play each other is an even number, then its not set
  40.                     to the correct value (only works for odd matches).
  41.            110197   Blanks are now removed from the filename, before
  42.                     creation.
  43.  1.2       110497   Added code to support Points_Per_Goals.
  44.  2.0       010997   Have been working on Scheduling for about a week. Put
  45.                     in code and now ready to test.
  46.            030997   Problem with format of '.sf' file - fixed. Program
  47.                     failed due to missing 'do' - fixed. All works.
  48.            050997   Added extra '*' at end of '.sf' file in line with
  49.                     manual created one.
  50.            070997   Fixed bug for AUTOSCHED - no. of matches in report was
  51.                     wrong - needed to be reset before the loop.
  52.            220997   Added code for promotion and divisions.
  53.            240997   Removed all data such as teams count, points per win,
  54.                     relegation etc, as they are already stored in '.df'.
  55.            250997   Wasn't creating the files - traced to resetting the
  56.                     strings that were used to pick the number of divisions
  57.                     and the divisions themselves, to the variables that
  58.                     are used as the assignments/counters. Made amendments
  59.                     to display of the report.
  60.            151297   Tidied display.
  61.            240898   Amended code that regenerates .df file as it was
  62.                     adding two blank lines before the teams and causing
  63.                     it to fail.
  64.            210499   Scheduler now tidies up previous files, ie. deleting
  65.                     a '.sflearn' file from a previous league.
  66.  2.1       050599   Added code to check the schedule file to see if it
  67.                     contains enough matches for the league to be played
  68.                     with the specified settings. Added support for playing
  69.                     teams an odd number of times and for schedules with
  70.                     teams playing it each other more than twice.
  71.                     Enhanced a few messages.
  72.  2.2       160699   Added code to support creation of '.stats' files. Fixed
  73.                     bug where Scheduler wouldn't allow 4 teams, 6 matches
  74.                     as it calculated it to 12 matches (World Cup) - amended
  75.                     if the number of matches is half that 'meant' to be
  76.                     played.
  77.            250899   Added error msg to file checks.
  78.            290899   Converted to use locale. Some error messages, before
  79.                     reading the locale, will still be in English.
  80.            010999   Converted to use a global date format file.
  81.            190999   Changed directory for schedule file.
  82.  
  83. **************************************************************************
  84.  
  85. Procedure
  86. ---------
  87.  
  88. 1. Check files exist.
  89. 2. Read 'Teams.df' and write teams to output file.
  90. 3. If AutoSched is specified then store parameters.
  91. 4. Using external program, sort the teams.
  92. 5. Re-read the teams and recreate 'Teams.df'.
  93. 6. Open 'Teams.df' for reading.
  94. 7. Extract data and store.
  95. 8. If no separator in it, then take it as a
  96.    team. Strip blanks and store.
  97. 9. Close input file.
  98. 10.IF AUTOMATIC - Read specified schedule file.
  99. 11.Read schedules and store dates/weeks.
  100. 12.Give error if the number of teams does not equal
  101.    the number of lines in the schedule file.
  102. 13.Write the dates/weeks to a file then use an
  103.    external program to sort them, writing back to the file.
  104. 14.Read dates into array and delete file.
  105. 15.Format dates array with season start date.
  106. 16.Format and write '.sf' files.
  107. 17.IF MANUAL - Open 'Teams.sf' file.
  108. 18.Write league name to it.
  109. 19.Loop and write all teams with a schedule of
  110.    all other teams. Number of matches is stored.
  111. 20.Close output file.
  112. 21.Open 'Teams.stats' for writing.
  113. 22.Write all data such as PLAYED,WIN,DRAW,LOST,GOALS_FOR,GOALS_AGAINST and
  114.    POINTS for each team.
  115. 23.Close file. Delete file (if found).
  116. 24.Create a report on the league created and then exit.
  117.  
  118. ************************************************************************** */
  119. PARSE ARG league_file
  120.  
  121. version      = 2
  122. league_file  = "Data/" || strip(league_file)
  123. input_file   = '.df'
  124. output_file  = '.sf'
  125. output2_file = '.stats'
  126. output3_file = '.temp'
  127. delput_file  = '.sflearn'
  128. title        = '*LEAGUE_NAME='
  129. points_win   = '*POINTS_PER_WIN='
  130. points_drw   = '*POINTS_PER_DRW='
  131. points_lse   = '*POINTS_PER_LSE='
  132. points_gls   = '*POINTS_PER_GLS='
  133. releg        = '*RELEGATION='
  134. playother    = '*PLAY_OTHER='
  135. promoted     = '*PROMOTED='
  136. num_divs     = '*NUM_DIVISIONS='
  137. divisions    = '*DIVISIONS='
  138. pkauthor     = '*  Author ='
  139. pkversion    = '*  Version='
  140. separator    = '*'
  141. teams.       = '???'
  142. tcount       = 0
  143. ttc          = 0
  144. ptsgls       = 0
  145. input2_file  = '.schd'
  146. separator    = '*'
  147. not_played   = '__   __'
  148. dateweeks.   = '???'
  149. tdateweeks.  = '???'
  150. schedules2.  = '???'
  151. schedules4.  = '???'
  152. schedules6.  = '???'
  153. schedules8.  = '???'
  154. schedules0.  = '???'
  155. autosched    = "*AUTOSCHD="
  156. autos        = 0
  157. ndivs        = 0
  158. promo        = 0
  159. divs         = ''
  160. oddnums      = "1 3 5 7 9"
  161. refdays      = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday" /* used for word positions */
  162.  
  163.  
  164. if open(datafile,"Data/Football.locale",'r') then do
  165.    line = readln(datafile)
  166.    locdir = strip(line)
  167.    close(datafile)
  168. end
  169. else do
  170.    say
  171.    say "ERROR :    (Scheduler)"
  172.    say
  173.    say "Cannot read 'Data/Football.locale' for the locale settings."
  174.    exit
  175. end
  176.  
  177. dfordir = locdir"Football.locale_data"
  178. locdir  = locdir"Exec/Scheduler.data"
  179.  
  180. if open(datafile,"ENV:FootballRXPath",'r') then do
  181.    line = readln(datafile)
  182.    rxdir = strip(line)
  183.    close(datafile)
  184. end
  185. else
  186.    rxdir = "SYS:Rexxc/"
  187.  
  188. if exists(locdir) > 0 then do
  189.   address command rxdir'rx 'locdir
  190.   VarCount = getclip('VarCount')
  191.   do i = 1 to VarCount
  192.     interpret getclip('var.'i)
  193.   end
  194. end
  195. else do
  196.    say
  197.    say "ERROR :    (Scheduler)"
  198.    say
  199.    say "Cannot find '"locdir"' to read locale settings."
  200.    exit
  201. end
  202.  
  203. if exists(dfordir) > 0 then do
  204.   address command rxdir'rx 'dfordir
  205.   VarCount = getclip('VarCount')
  206.   do i = 1 to VarCount
  207.     interpret getclip('var.'i)
  208.   end
  209. end
  210. else do
  211.    say
  212.    say "ERROR :    (Scheduler)"
  213.    say
  214.    say "Cannot find '"dfordir"' to read date locale settings."
  215.    exit
  216. end
  217.  
  218. if exists(league_file || input_file) = 0 then do
  219.    say
  220.    say s_error
  221.    say
  222.    say s_t1"'"league_file||input_file"'."
  223.    exit
  224. end
  225.  
  226. tcount = 0
  227. if open(datafile,league_file || input_file,'r') then do
  228.    if open(datafile2,league_file || output3_file,'w') then do
  229.       do while ~eof(datafile)
  230.          line = readln(datafile)
  231.          line = strip(line)
  232.          if pos(separator,line) > 0 & line ~='' then do
  233.             if pos(autosched,line) > 0 then do
  234.                autofile = delstr(line,1,10)
  235.                autos = 1
  236.             end
  237.             tcount = tcount + 1
  238.             teams.tcount = line
  239.          end
  240.          else do
  241.             ttc = ttc + 1
  242.             writeln(datafile2,line)
  243.          end
  244.       end
  245.       close(datafile2)
  246.    end
  247.    else do
  248.       say
  249.       say s_error
  250.       say
  251.       say s_t2"'"league_file||output3_file"'."
  252.       close(datafile)
  253.       exit
  254.    end
  255.    close(datafile)
  256. end
  257. else do
  258.    say
  259.    say s_error
  260.    say
  261.    say s_t3"'"league_file || input_file"'"s_t4
  262.    exit
  263. end
  264.  
  265. address command 'sort 'league_file || output3_file league_file || output3_file
  266.  
  267. if open(datafile2,league_file || output3_file,'r') then do
  268.    if open(datafile,league_file || input_file,'w') then do
  269.       do i=1 to tcount
  270.          if teams.i ~= '' then
  271.             writeln(datafile,teams.i)
  272.       end
  273.       do j=1 to ttc                   /* while ~eof(datafile2)  */
  274.          line = readln(datafile2)
  275.          line = strip(line)
  276.          if line ~= '' then do
  277.             if j = ttc then
  278.                writech(datafile,line)
  279.             else
  280.                writeln(datafile,line)
  281.          end
  282.       end
  283.       close(datafile)
  284.    end
  285.    else do
  286.       say
  287.       say s_error
  288.       say
  289.       say s_t2"'"league_file||input_file"'."
  290.       close(datafile2)
  291.       exit
  292.    end
  293.    close(datafile2)
  294. end
  295. else do
  296.    say
  297.    say s_error
  298.    say
  299.    say s_t3"'"league_file || output3_file"'"s_t4
  300.    exit
  301. end
  302.  
  303. address command 'delete >NIL: 'league_file || output3_file
  304.  
  305. tcount = 0
  306. if open(datafile,league_file || input_file,'r') then do
  307.    do while ~eof(datafile)
  308.       line = readln(datafile)
  309.       if pos(title,line) > 0 then        league_title = delstr(line,1,13)
  310.       if pos(pkauthor,line) > 0 then     author = delstr(line,1,12)
  311.       if pos(pkversion,line) > 0 then    fversion = delstr(line,1,12)
  312.       if pos(points_win,line) > 0 then   ptswin=delstr(line,1,16)
  313.       if pos(points_drw,line) > 0 then   ptsdrw=delstr(line,1,16)
  314.       if pos(points_lse,line) > 0 then   ptslse=delstr(line,1,16)
  315.       if pos(points_gls,line) > 0 then   ptsgls=delstr(line,1,16)
  316.       if pos(releg,line) > 0 then        reg = delstr(line,1,12)
  317.       if pos(playother,line) > 0 then    playo = delstr(line,1,12)
  318.       if pos(promoted,line) > 0 then     promo = delstr(line,1,10)
  319.       if pos(num_divs,line) > 0 then     ndivs = delstr(line,1,15)
  320.       if pos(divisions,line) > 0 then    divs  = delstr(line,1,11)
  321.       if pos(separator,line) = 0 then do
  322.          line = strip(line)
  323.          tcount       = tcount + 1
  324.          teams.tcount = line
  325.       end
  326.    end
  327.    close(datafile)
  328. end
  329. else do
  330.    say
  331.    say s_error
  332.    say
  333.    say s_t3"'"league_file || input_file"'."
  334.    exit
  335. end
  336.  
  337. if ndivs > 1 then do
  338.    if words(divs)+1 ~= ndivs then do
  339.       say
  340.       say s_error
  341.       say
  342.       say s_t6
  343.       say s_t7
  344.       say s_t8
  345.       say s_t9
  346.       say s_t10
  347.       say
  348.       say s_t11
  349.       say " "words(divs)""s_t12""ndivs"."
  350.       say s_t13"'"words(divs)+1"'"s_14
  351.       say
  352.       say s_t15
  353.       say
  354.       say
  355.       say s_t16"'"league_file || input_file"'"s_t17
  356.       exit
  357.    end
  358.  
  359.    fd = 0
  360.    do i=1 to ndivs-1
  361.       if exists("Data/"||word(divs,i)||input_file) = 0 then do
  362.          if fd = 0 then do
  363.             say
  364.             say s_error
  365.             say
  366.          end
  367.          say s_t18"'"word(divs,i)"'"s_t19
  368.          fd = fd + 1
  369.       end
  370.    end
  371.    if fd > 0 then do
  372.       say
  373.       say
  374.       say s_t16"'"league_file || input_file"'"s_t17
  375.       exit
  376.    end
  377. end
  378.  
  379.                                           /* Automatic Schedule creation */
  380. if autos = 1 then do
  381.    if exists("Data/Schedules/"autofile||input2_file) = 0 then do
  382.       say
  383.       say s_error
  384.       say
  385.       say s_t1"'Data/Schedules/"autofile||input2_file"'."
  386.       say
  387.       say
  388.       say s_t16"'"league_file || input_file"'"s_t17
  389.       exit
  390.    end
  391.  
  392.    ct = 0
  393.    sct2= 0
  394.    sct4= 0
  395.    sct6= 0
  396.    sct8= 0
  397.    sct0= 0
  398.    weeks = 0
  399.    dates = 0
  400.    sch = 1
  401.  
  402.    if open(datafile,"Data/Schedules/"autofile||input2_file,'r') then do
  403.       mkct = ((tcount - 1) * playo) * (tcount/2)
  404.       kmct = 0
  405.       do while ~eof(datafile)
  406.          line = readln(datafile)
  407.          if line ~= '' & pos(separator,line) = 0 then do
  408.             counter = words(line)
  409.             do i=1 to counter
  410.                if word(line,i) ~= 0 then
  411.                   kmct = kmct + 1
  412.             end
  413.          end
  414.       end
  415.       close(datafile)
  416.    end
  417.    else do
  418.       say
  419.       say s_error
  420.       say
  421.       say s_t1"'Data/Schedules/"autofile||input2_file"'"s_t5
  422.       say
  423.       say
  424.       say s_t16"'"league_file || input_file"'"s_t17
  425.       exit
  426.    end
  427.  
  428.    mongoose = mkct / kmct
  429.  
  430.    if mkct ~= kmct & pos(".",mongoose) > 0 then do
  431.       say
  432.       say s_error
  433.       say
  434.       say s_t20"'Data/Schedules/"autofile||input2_file"'"
  435.       say s_t21""tcount""s_t22
  436.       say playo""s_t23""kmct""s_t24""mkct""s_t25
  437.       say s_t26
  438.       say s_t27
  439.       say
  440.       say
  441.       say s_t16"'"league_file || input_file"'"s_t17
  442.       exit
  443.    end
  444.  
  445.    if open(datafile,"Data/Schedules/"autofile||input2_file,'r') then do
  446.       do while ~eof(datafile)
  447.          line = readln(datafile)
  448.          if pos("*WEEKS",line) then do
  449.             weeks=1
  450.          end
  451.          if pos("*DATES=",line) then do
  452.             startdate=substr(line,8,8)
  453.             dates = 1
  454.          end
  455.          if pos("*NEXT",line) > 0 then sch = sch + 1
  456.          if line ~= '' & pos(separator,line) = 0 then do
  457.             if sch = 1 then do
  458.                sct2 = sct2 + 1
  459.                schedules2.sct2 = line
  460.             end
  461.             if sch = 2 then do
  462.                sct4 = sct4 + 1
  463.                schedules4.sct4 = line
  464.             end
  465.             if sch = 3 then do
  466.                sct6 = sct6 + 1
  467.                schedules6.sct6 = line
  468.             end
  469.             if sch = 4 then do
  470.                sct8 = sct8 + 1
  471.                schedules8.sct8 = line
  472.             end
  473.             if sch = 5 then do
  474.                sct0 = sct0 + 1
  475.                schedules0.sct0 = line
  476.             end
  477.             counter = words(line)
  478.             do i=1 to counter
  479.                sdate = word(line,i)
  480.                if sdate = 0 then
  481.                   iterate
  482.                if ct = 0 then do
  483.                   ct = ct + 1
  484.                   dateweeks.ct = sdate
  485.                end
  486.                else do
  487.                   ij = 0
  488.                   do j=1 to ct
  489.                      if sdate = dateweeks.j then do
  490.                         ij = 1
  491.                         leave
  492.                      end
  493.                   end
  494.                   if ij = 0 then do
  495.                      ct = ct + 1
  496.                      dateweeks.ct = sdate
  497.                   end
  498.                end
  499.             end
  500.          end
  501.       end
  502.       close(datafile)
  503.    end
  504.    else do
  505.       say
  506.       say s_error
  507.       say
  508.       say s_t1"'Data/Schedules/"autofile||input2_file"'"s_t5
  509.       say
  510.       say
  511.       say s_t16"'"league_file || input_file"'"s_t17
  512.       exit
  513.    end
  514.  
  515.    sct = (sct2 + sct4 + sct6 + sct8 + sct0) / sch
  516.  
  517.    if counter ~= sct then do
  518.       say
  519.       say s_error
  520.       say
  521.       say s_t28""sct""s_t29
  522.       say s_t30""counter""s_t31
  523.       say
  524.       say s_t32
  525.       say
  526.       say
  527.       say s_t16"'"league_file || input_file"'"s_t17
  528.       exit
  529.    end
  530.  
  531.    if open(datafile2,"RAM:schd.temp",'w') then do
  532.       do j=1 to ct
  533.          writeln(datafile2,dateweeks.j)
  534.       end
  535.       close(datafile2)
  536.    end
  537.    else do
  538.       say
  539.       say s_error
  540.       say
  541.       say s_t33
  542.       say
  543.       say
  544.       say s_t16"'"league_file || input_file"'"s_t17
  545.       exit
  546.    end
  547.  
  548.    if weeks = 1 then
  549.       address command 'sort RAM:schd.temp RAM:schd.temp'
  550.    if dates = 1 then
  551.       address command 'Exec/SortWkDts'
  552.  
  553.    if open(datafile2,"RAM:schd.temp",'r') then do
  554.       do j=1 to ct
  555.          dateweeks.j = readln(datafile2)
  556.       end
  557.       close(datafile2)
  558.    end
  559.    else do
  560.       say
  561.       say s_error
  562.       say
  563.       say s_t34
  564.       say
  565.       say
  566.       say s_t16"'"league_file || input_file"'"s_t17
  567.       exit
  568.    end
  569.  
  570.    address command 'delete >NIL: RAM:schd.temp'
  571.  
  572.    if dates = 1 then do
  573.       do j=1 to ct
  574.          if dateweeks.j = startdate then do
  575.             do i=1 to j-1
  576.                tdateweeks.i = dateweeks.i
  577.             end
  578.             k = 1
  579.             do i=j to ct
  580.                dateweeks.k = dateweeks.i
  581.                k = k + 1
  582.             end
  583.             do i=1 to j-1
  584.                dateweeks.k = tdateweeks.i
  585.                k = k + 1
  586.             end
  587.             leave
  588.          end
  589.       end
  590.    end
  591.  
  592.    if open(outfile,league_file || output_file,"w") then do
  593.       writeln(outfile,"*")
  594.       writeln(outfile,"**" league_title)
  595.       writeln(outfile,"*")
  596.       writeln(outfile,"*")
  597.  
  598.       matches = 0
  599.       do i=1 to ct
  600.          if weeks = 1 then
  601.             writeln(outfile,"*Week: "dateweeks.i)
  602.          if dates = 1 then do
  603.             mnth = substr(dateweeks.i,3,2)
  604.             ndate= substr(dateweeks.i,5,4)||mnth||substr(dateweeks.i,1,2)
  605.             weekd= date('w',ndate,'s')
  606.             do kw=1 to 7
  607.                if weekd = word(refdays,kw) then do
  608.                   weekd = word(days,kw)
  609.                   leave
  610.                end
  611.             end
  612.             parse var date_format "day" sp1 "number" sp2 "month" sp3 "year" .
  613. /* DATE */
  614.             writeln(outfile,"*Date: "weekd||sp1||substr(dateweeks.i,1,2)||sp2||word(months,mnth)||sp3||substr(dateweeks.i,5,4))
  615.          end
  616.          writeln(outfile,"*")
  617.  
  618.          do k=1 to counter
  619.             do j=1 to counter
  620.                do l=1 to sch
  621.                   if l=1 then sdate = word(schedules2.k,j)
  622.                   if l=2 then sdate = word(schedules4.k,j)
  623.                   if l=3 then sdate = word(schedules6.k,j)
  624.                   if l=4 then sdate = word(schedules8.k,j)
  625.                   if l=5 then sdate = word(schedules0.k,j)
  626.                   if dateweeks.i = sdate then do
  627.                      writech(outfile,left(teams.k,30))
  628.                      writeln(outfile," __   __ " teams.j)
  629.                      matches = matches + 1
  630.                      leave
  631.                   end
  632.                end
  633.             end
  634.          end
  635.          writeln(outfile,"*")
  636.       end
  637.       writeln(outfile,"*")
  638.       close(outfile)
  639.    end
  640.    else do
  641.       say
  642.       say s_error
  643.       say
  644.       say s_t2"'"league_file || output_file"'."
  645.       say
  646.       say
  647.       say s_t16"'"league_file || input_file"'"s_t17
  648.       exit
  649.    end
  650. end
  651.                                           /* Manual Schedule creation */
  652. if autos = 0 then do
  653.    if open(outfile,league_file || output_file,"w") then do
  654.       writeln(outfile,"*")
  655.       writeln(outfile,"**" league_title)
  656.       writeln(outfile,"*")
  657.       writeln(outfile,"*")
  658.  
  659.       plyo = playo                    /* this handles playing odd times each team */
  660.       if pos(playo,oddnums) > 0 then
  661.          plyo = plyo + 1
  662.  
  663.       increm = plyo / 2
  664.       matches = 0
  665.       do k=1 to increm
  666.          do i=1 to tcount
  667.             do j=1 to tcount
  668.                if j~=i then do
  669.                    writech(outfile,left(teams.i,30))
  670.                    writeln(outfile," __   __ " teams.j)
  671.                    matches = matches + 1
  672.                end
  673.             end
  674.             writeln(outfile,"*")
  675.             if i ~= tcount then
  676.                writeln(outfile,"*")
  677.          end
  678.       end
  679.       writech(outfile,"*")
  680.       close(outfile)
  681.    end
  682.    else do
  683.       say
  684.       say s_error
  685.       say
  686.       say s_t2"'"league_file || output_file"'."
  687.       say
  688.       say
  689.       say s_t16"'"league_file || input_file"'"s_t17
  690.       exit
  691.    end
  692. end
  693.  
  694. if exists(league_file||output2_file) = 0 then do
  695.    if open(outfile,league_file || output2_file,"w") then do
  696.       writeln(outfile,title""league_title)
  697.       do i=1 to tcount
  698.          writeln(outfile,"*TEAM="teams.i)
  699.          writeln(outfile,"*PLY=0")
  700.          writeln(outfile,"*WIN=0")
  701.          writeln(outfile,"*DRW=0")
  702.          writeln(outfile,"*LST=0")
  703.          writeln(outfile,"*GOF=0")
  704.          writeln(outfile,"*GOA=0")
  705.          if i = tcount then
  706.             writech(outfile,"*PTS=0")
  707.          else
  708.             writeln(outfile,"*PTS=0")
  709.       end
  710.       close(outfile)
  711.    end
  712.    else do
  713.       say
  714.       say s_error
  715.       say
  716.       say s_t2"'"league_file || output2_file"'."
  717.       say
  718.       say
  719.       say s_t16"'"league_file || input_file"'"s_t17
  720.       exit
  721.    end
  722. end
  723.                                          /* create report */
  724. select
  725.    when playo = 2 then playo = s_t58
  726.    otherwise
  727.       playo = playo" "s_t56
  728. end
  729.  
  730.  
  731. /* ..and after all files have been created, lets clear up any previous... */
  732.  
  733. if exists(league_file||delput_file) > 0 then
  734.    address command 'c:Delete >NIL: 'league_file||delput_file
  735.  
  736. say
  737. say center(s_t35"'"league_title"'",78)
  738. say "-------------------------------------------------------------------------------"
  739. say "                                               "s_t36""date('e')""s_t37""time()
  740. say
  741. say s_t38""author
  742. say s_t39""fversion
  743. say "_______________________________________________________________________________"
  744. say
  745. say s_t40""tcount"                  "s_t41""matches
  746. say
  747. say s_t42""ptswin" "s_t57".            "s_t43""reg
  748. say s_t44""ptsdrw" "s_t57".            "s_t45""playo
  749. say s_t46""ptslse" "s_t57".            "s_t47""ptsgls
  750. say "                          "s_t48""promo
  751. say
  752. say s_t49""ndivs"   "s_t50
  753. say s_t51""divs
  754. say
  755. if autos = 1 then do
  756.    say s_t52"'"autofile||input2_file"'."
  757.    say
  758. end
  759. /*
  760. if matches > 999 then
  761.    say "*   "s_t53"    *"
  762. */
  763. say "_______________________________________________________________________________"
  764. say
  765. say s_t54
  766. say s_t55
  767. say
  768. do i=1 to tcount
  769.    say teams.i
  770. end
  771. say
  772. say "-------------------------------------------------------------------------------"
  773. say
  774.  
  775. exit